package com.itfreer.power.dao.role;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;

import org.springframework.beans.BeanUtils;

import com.itfreer.form.api.JdbcBaseEntity;
import com.itfreer.power.entity.role.RoleEntrustEntity;

/**
 * 定义角色委托实体类
 */
@Entity(name = "sso_role_entrust")
public class JdbcRoleEntrustEntity implements JdbcBaseEntity<RoleEntrustEntity>, Serializable {
	
	private static final long serialVersionUID = -4336770122891621550L;

	@Id
	@Column(name = "id", length = 50, nullable = false)
	private String id;
	
	/**
	 * 委托人ID
	 */
	@Column(name = "entrust_user_id", length = 50, nullable = false)
	private String entrustUserId;
	
	/**
	 * 委托人名称
	 */
	@Column(name = "entrust_user_name", length = 50, nullable = false)
	private String entrustUserName;

	/**
	 * 被委托者ID
	 */
	@Column(name = "entrusted_user_id", length = 50, nullable = false)
	private String entrustedUserId;
	
	/**
	 * 被委托者名称
	 */
	@Column(name = "entrusted_user_name", length = 50, nullable = false)
	private String entrustedUserName;

	/**
	 * 委托角色
	 */
	@Column(name = "entrust_role_id", length = 50, nullable = false)
	private String entrustRoleId;
	
	/**
	 * 委托开始时间
	 */
	@Column(name = "begin_time", nullable = false)
	private Date beginTime;
	
	/**
	 * 委托结束时间
	 */
	@Column(name = "end_time", nullable = false)
	private Date endTime;
	
	/**
	 * 是否启用
	 */
	@Column(name = "can_use", nullable = false)
	private Boolean canUse;
	
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	/**
	 * 委托人ID
	 */
	public String getEntrustUserId() {
		return entrustUserId;
	}

	/**
	 * 委托人ID
	 */
	public void setEntrustUserId(String entrustUserId) {
		this.entrustUserId = entrustUserId;
	}

	/**
	 * 被委托者ID
	 */
	public String getEntrustedUserId() {
		return entrustedUserId;
	}

	/**
	 * 被委托者ID
	 */
	public void setEntrustedUserId(String entrustedUserId) {
		this.entrustedUserId = entrustedUserId;
	}

	/**
	 * 委托角色
	 */
	public String getEntrustRoleId() {
		return entrustRoleId;
	}

	/**
	 * 委托角色
	 */
	public void setEntrustRoleId(String entrustRoleId) {
		this.entrustRoleId = entrustRoleId;
	}

	/**
	 * 委托开始时间
	 */
	public Date getBeginTime() {
		return beginTime;
	}

	/**
	 * 委托开始时间
	 */
	public void setBeginTime(Date beginTime) {
		this.beginTime = beginTime;
	}

	/**
	 * 委托结束时间
	 */
	public Date getEndTime() {
		return endTime;
	}

	/**
	 * 委托结束时间
	 */
	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	/**
	 * 是否启用
	 */
	public Boolean getCanUse() {
		return canUse;
	}

	/**
	 * 是否启用
	 */
	public void setCanUse(Boolean isUse) {
		this.canUse = isUse;
	}

	public String getEntrustUserName() {
		return entrustUserName;
	}

	public void setEntrustUserName(String entrustUserName) {
		this.entrustUserName = entrustUserName;
	}

	public String getEntrustedUserName() {
		return entrustedUserName;
	}

	public void setEntrustedUserName(String entrustedUserName) {
		this.entrustedUserName = entrustedUserName;
	}
	
	@Override
	public void from(RoleEntrustEntity t) {
		BeanUtils.copyProperties(t, this);
	}

	@Override
	public RoleEntrustEntity toEntity() {
		RoleEntrustEntity toEntity = new RoleEntrustEntity();
		BeanUtils.copyProperties(this, toEntity);
		return toEntity;
	}
}
